#ifndef _UIEDITCONTROL_
#define _UIEDITCONTROL_

#include "../GUI/GUIControl.h"
#include <string>
#include <vector>

typedef std::wstring WSTRING;

// Edit Box Type : Single, Multi, Password
#define EDIT_SINGLELINE 0x00
#define EDIT_PASSWORD   0x01
#define EDIT_MULTILINE  0x02

class UIEDITCONTROL : public CONTROL {
private:
	// Caption
	std::vector<WSTRING>    _caption;
	LPD3DXFONT              _pFont;
	DWORD                   _fontColor;

private:
	// Texture
	LPDIRECT3DTEXTURE9 _texture;
	RECT               _textureRect;

private:
	// Property
	BOOL  _bReadOnly;
	DWORD _editType;
	INT   _nCursorPos;

public:
	UIEDITCONTROL(DWORD ID, POINT point, RECT rect, LPWSTR lpszImgAddr);
	UIEDITCONTROL(DWORD ID, POINT point, RECT rect, LPWSTR lpszImgAddr, BOOL bReadOnly, DWORD editType);
	~UIEDITCONTROL(VOID);
	
	VOID RenderCaption(VOID);
	virtual VOID Render(VOID);
	virtual LRESULT WINAPI MsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

	VOID RegisterEvent(VOID (*fp)(), EVENT _event);

	// Get
	LPDIRECT3DTEXTURE9& GetTexture(VOID)	{ return _texture; }

	// Set
	VOID SetTexture(LPWSTR lpszImgAddr);
	VOID SetFont(LPWSTR pFaceName, INT fontHeight, BOOL bItalic);
	VOID SetCaption(WCHAR* caption);
	VOID SetClearCaption(VOID);
	VOID SetFontColor(DWORD dwColor) { _fontColor = dwColor; }

protected:
	// Event Method
	VOID OnChar(WPARAM wParam);
};

#endif